package net.lab1024.sa.admin.module.business.file.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.file.domain.form.add.DocmentbAddForm;
import net.lab1024.sa.admin.module.business.file.domain.form.query.DocmentbQueryForm;
import net.lab1024.sa.admin.module.business.file.domain.form.update.DocmentbUpdateForm;
import net.lab1024.sa.admin.module.business.file.domain.vo.DocmentbVO;
import net.lab1024.sa.admin.module.business.file.service.DocmentbService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * 生产订单与机器对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-07-08 15:14:54
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与机器对应表")
public class DocmentbController {

    @Resource
    private DocmentbService docmentbService;

    @PostMapping("/docmentb/queryPage")
    public ResponseDTO<PageResult<DocmentbVO>> queryPage(@RequestBody @Valid DocmentbQueryForm queryForm) {
        return ResponseDTO.ok(docmentbService.queryPage(queryForm));
    }

    @PostMapping("/docmentb/add")
    public ResponseDTO<String> add(@RequestBody @Valid DocmentbAddForm addForm) {
        return docmentbService.add(addForm);
    }


    @PostMapping("/docmentb/batchAdd")
    public ResponseDTO<String> batchAdd(@RequestBody DocmentbAddForm docmentbAddForm) {
        return docmentbService.batchAdd(docmentbAddForm);
    }

    @SaCheckPermission("docmentb:update")
    public ResponseDTO<String> update(@RequestBody @Valid DocmentbUpdateForm updateForm) {
        return docmentbService.update(updateForm);
    }

    @PostMapping("/docmentb/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return docmentbService.batchDelete(idList);
    }

    @GetMapping("/docmentb/delete")
    public ResponseDTO<String> batchDelete(@RequestParam Long docEntry, @RequestParam Integer lineNum) {
        return docmentbService.delete(docEntry,lineNum);
    }

    @PostMapping("/docmentb/deleteList")
    public ResponseDTO<String> deleteList(@RequestBody Map<String,Object> map) {

        return docmentbService.deleteList(map);
    }


}
